//var isPalindrome = function(x) {
  //  let str=x.toString();//"12321"
    //let arr=str.split('')//['1','2','3','2','1']
    //let newarr=arr.reverse();
    //let newstr=newarr.join('');
    //return str==newstr;
//};

var isPalindrome=function(x){
    let res=0
    let num=x
    while(num){
        let last=num%10
        res=last*10+last 
        num=num/10
    }
    return res===x;
};
console.log(isPalindrome(12321))